package com.pureut.order.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pureut.order.domain.PurchaseOrder;
import com.pureut.order.dto.CustomerSaleRankDto;
import com.pureut.order.dto.PurchaseOrderDto;
import com.pureut.order.dto.PurchaseOrderTraceDto;
import com.pureut.order.vo.PurchaseOrderVo;
import com.sale.common.mybatis.core.mapper.BaseMapperPlus;
import com.sale.order.api.vo.PurchaseOrderTraceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 采购订单mapper
 */
@Mapper
public interface PurchaseOrderMapper extends BaseMapperPlus<PurchaseOrderMapper, PurchaseOrder, PurchaseOrder> {

    /**
     * 采购订单列表
     */
    Page<Map<String,Object>> getPurchaseOrderList(@Param("code") String code, @Param("page") Page<PurchaseOrderDto> page, @Param("purchaseOrderVo") PurchaseOrderVo purchaseOrderVo);

    /**
     * 查看订单信息
     */
    Map<String,Object> getViewById(Long id);

    /**
     * 获取审核过后的（待到货、部分到货）采购订单数据
     */
    Page<PurchaseOrderDto> getPurchaseOrderPassList(@Param("page") Page<PurchaseOrderDto> page, @Param("purchaseOrderVo") PurchaseOrderVo purchaseOrderVo);

    /**
     * 采购订单数(首页工作台使用)
     * @param format
     * @return
     */
    String getPurchaseOrderNum(String format);

    /**
     * //获取当前时间之前的所有采购订单号
     * @param format
     */
    String getPurchaseOrderPrice(String format);

    /**
     * 前五大供应商采购占比(元)
     * @param format
     * @return
     */
    List<CustomerSaleRankDto> supplierSaleRank(String format);

    /**
     * 获取审核通过的数据
     */
    List<PurchaseOrderTraceDto> getPassList(@Param("purchaseOrderTraceVo") PurchaseOrderTraceVo purchaseOrderTraceVo);

    /**
     * 采购订单手动新增
     * @param code
     * @param addMap
     * @return
     */
    boolean insertMessage(@Param("code") String code, @Param("addMap") Map<String, Object> addMap);

    /**
     * 采购订单修改
     * @param id
     * @param updateMap
     * @return
     */
    boolean updateProcurementPlan(@Param("id") Long id, @Param("updateMap") Map<String, Object> updateMap);
}
